package com.yizhang.xml.dao.impl;

import com.yizhang.xml.dao.UserDao;
import com.yizhang.xml.entity.User;
import com.yizhang.xml.mapper.UserMapper;

import java.util.List;

public class UserDaoImpl implements UserDao {

    private UserMapper userMapper;

    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @Override
    public void show() {
        List<User> users = userMapper.findAll();
        for (User user : users) {
            System.out.println(user);
        }
        System.out.println("show============");
    }

    @Override
    public void transfer() {
        userMapper.transfer("zhangyi", 500);
        int i = 1/0;
        userMapper.transfer("lisi", -500);
    }
}
